<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .fade-enter-active, .fade-leave-active{
            transition: opacity .5s ease;
        }
        .fade-enter, .fade-leave-to{
            opacity: 0;
        }
    </style>
    <script src="./vue.js"></script>
</head>
<body>
    <template id="example1"><span>login</span></template>
    <template id="example2"><span>xxxxx</span></template>
<div id="app">
    <a href="javascript:;" @click="compontentName='example1'">login</component>"
 <a href="javascript:;" @click="compontentName='example2'">xxxxx</component>"
<transition name="fade" mode="in-out">
    <component :is="compontentName"></component>
</transition>


</div>
<script>
Vue.component('example1',{template:'#example1'})
Vue.component('example2',{template:'#example2'})
var vm = new Vue({
    el:'#app',
    data:{componentName:''}
})


</script>

</body>
</html>